/* -------------------------------------------------------------------------- *
   TestWinUnit - Maria Blees (maria.blees@microsoft.com)

   File: LoggerTest.cpp

   The Logger class is mostly abstract but it does have one method to be 
   tested (a convenience function: OutputWinapiError).
 * -------------------------------------------------------------------------- */
#include "WinUnit.h"

#include "MockLogger.h"

BEGIN_TEST(LoggerOutputWinapiErrorHasCorrectFormat)
{
    wchar_t* thisFunctionName = __WFUNCTION__;
    WIN_ASSERT_STRING_EQUAL(thisFunctionName, L"TEST_LoggerOutputWinapiErrorHasCorrectFormat");

    MockLogger logger;
    // Error 0x00000001 = "Incorrect function."
    logger.OutputWinapiError(0x0000001, __WFUNCTION__, 
        L"msg3", L"msg4");

    WIN_ASSERT_EQUAL(1, logger.OutputProgramErrorLineCalled);
    WIN_ASSERT_STRING_EQUAL(__WFUNCTION__ L": msg3msg4. Incorrect function.",
                 logger.OutputProgramErrorLine_msg1);
}
END_TEST

BEGIN_TEST(LoggerOutputWinapiErrorWorksWithOneArg)
{
    wchar_t* thisFunctionName = __WFUNCTION__;
    WIN_ASSERT_STRING_EQUAL(thisFunctionName, L"TEST_LoggerOutputWinapiErrorWorksWithOneArg");

    MockLogger logger;
    // Error 0x00000001 = "Incorrect function."
    logger.OutputWinapiError(0x0000001, __WFUNCTION__, L"msg3");

    WIN_ASSERT_EQUAL(1, logger.OutputProgramErrorLineCalled);
    WIN_ASSERT_STRING_EQUAL(__WFUNCTION__ L": msg3. Incorrect function.",
        logger.OutputProgramErrorLine_msg1);
}
END_TEST